const mongoose = require('mongoose');

const ProductMasterSchema = new mongoose.Schema({
  batchId: {type: String, required: true},
  previousBatchId: {type: String, required: true},
  asin: {type: String, required: true},
  sku: {type: String, required: true},
  ptSellerAccountId: {type: String, required: true},
  ptSellerAccountStoreId: {type: String, required: true},
  approvalLog: {type: [{
      approver: {type: String},
      comments: {type: String},
      date: {type: Date},
      isApproved: {type: Boolean},
    }], required: true},
  amazonSubmissionLog: {type: String, required: true},
  listingStatus: {type: String, enum: ['Draft', 'Active', 'Inactive', 'Unlisted'], required: true},
  state: {type: String, required: true},
  creationDateTime: {type: Date, default: Date.now, required: true},
  lastModifiedDateTime: {type: Date, default: Date.now, required: true}
}, {collection: 'ProductMasters', timestamps: true});

mongoose.model('ProductMasterSchema', ProductMasterSchema);